import request from '@/utils/request'

// 查询项目功能测试点列表
export function listPoint(query) {
  return request({
    url: '/ai_smart/point/list',
    method: 'get',
    params: query
  })
}

// 查询项目功能测试点详细
export function getPoint(id) {
  return request({
    url: '/ai_smart/point/' + id,
    method: 'get'
  })
}

// 查询项目功能测试点详细
export function getPoint_(data) {
  return request({
    url: '/ai_smart/point/get/',
    method: 'post',
    data: data
  })
}

// 新增项目功能测试点
export function addPoint(data) {
  return request({
    url: '/ai_smart/point',
    method: 'post',
    data: data
  })
}

// 修改项目功能测试点
export function updatePoint(data) {
  return request({
    url: '/ai_smart/point',
    method: 'put',
    data: data
  })
}

// 修改项目功能测试点
export function updatePoint_(data) {
  return request({
    url: '/ai_smart/point/type',
    method: 'put',
    data: data
  })
}

// 删除项目功能测试点
export function delPoint(id) {
  return request({
    url: '/ai_smart/point/' + id,
    method: 'delete'
  })
}


// 调用ai生成单个测试用例接口
export function aiCreateSignalCase(data) {
  return request({
    url: '/ai_smart/point/ai_create_signal_test_case/',
    method: 'post',
    data: data
  })
}

// 调用ai批量生成测试用例接口
export function aiCreateBatchCase(data) {
  return request({
    url: '/ai_smart/point/ai_create_batch_test_case/',
    method: 'post',
    data: data
  })
}

// 获取ai批量生成测试用例进度
export function getBatchTaskRecord() {
  return request({
    url: '/ai_smart/point/get_ai_create_batch_test_case_task_record/' + new Date().getTime(),
    method: 'get'
  })
}

// 获取项目列表
export function getProjectList(){
  return request({
    url: '/ai_smart/point/projects',
    method: 'get'
  })
}

// 获取功能树根据项目编号
export function listFun(projectNo){
  return request({
    url: '/ai_smart/point/fun/' + projectNo,
    method: 'get'
  })
}


// 测试点通过审核
export function point_checked_pass(pointNo) {
  return request({
    url: '/ai_smart/point/check/' + pointNo,
    method: 'post'
  })
}

// 查看测试点历史记录
export function point_history(pointNo) {
  return request({
    url: '/ai_smart/point/history/' + pointNo,
    method: 'post'
  })
}

export function aiCreateCase(data){
  return request({
    url: '/ai_smart/point/create_ai_case' ,
    data: data,
    method: 'post'
  })
}

export function get_fun_info_detail(funNo){
  return request({
      url: '/ai_smart/point/get_edit_point_project_fun_info_by_fun_no/' +funNo,
      method: 'post'
    })
}

// 一键评审
export function batchCheck(data){
  return request({
    url: '/ai_smart/point/all_check/',
    method: 'post',
    data: data
  })
}

// 用例优化
export function optimizeTestCase(data){
  return request({
    url: '/ai_smart/test_case_optimize/optimize/',
    method: 'post',
    data: data
  })
}